* {
	margin: 0;
	padding: 0;
}

html {
	width: 100vw;
	height: 100vh;
	display: flex;
    justify-content: center;
    align-items: center;
}

.wrap {
	perspective: 1000px;
	/* 视图距元素的距离 相当于摄像机 */
}

.cube {
	width: 200px;
	height: 200px;
	position: relative;
	color: #fff;
	font-size: 36px;
	font-weight: bold;
	text-align: center;
	line-height: 200px;
	transform-style: preserve-3d;
	/* 默认flat 2D */
	transform: rotateX(-30deg) rotateY(-70deg);
	animation: rotate 20s infinite linear;
	/*播放时间 播放次数为循环 缓动效果为匀速 */
}
.cube:hover {
	animation-play-state: paused;
}

.cube>div {
	width: 100%;
	height: 100%;
	border: 1px solid #fff;
	position: absolute;
	transition: transform 0.4s ease-in;
	box-shadow: 0px 0px 30px 10px #00e7ff;
	border-radius: 40px;
	overflow: hidden;
}

.cube .out-front {
	transform: translateZ(100px);
}

.cube .out-back {
	transform: translateZ(-100px) rotateY(180deg);
}

.cube .out-left {
	transform: translateX(-100px) rotateY(-90deg);
}

.cube .out-right {
	transform: translateX(100px) rotateY(90deg);
}

.cube .out-top {
	transform: translateY(-100px) rotateX(90deg);
}

.cube .out-bottom {
	transform: translateY(100px) rotateX(-90deg);
}

.auto-img {
	display: block;
	width: 100%;
	height: 100%;
	transition: all .5s ease;
	filter: grayscale(1);
}


.cube .inner {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100px;
	height: 100px;
	border: 1px solid black;
	background-color: #999;
	position: absolute;
	top: 50px;
	left: 50px;
}

.cube .in-front {
	transform: translateZ(50px);
}

.cube .in-back {
	transform: translateZ(-50px) rotateY(180deg);
}

.cube .in-left {
	transform: translateX(-50px) rotateY(-90deg);
}

.cube .in-right {
	transform: translateX(50px) rotateY(90deg);
}

.cube .in-top {
	transform: translateY(-50px) rotateX(90deg);
}

.cube .in-bottom {
	transform: translateY(50px) rotateX(-90deg);
}

.wrap:hover .auto-img {
	filter: grayscale(0);
	transform: scale(1.2, 1.2);
}
.wrap:hover .out-front {
	transform: translateZ(200px);
}

.wrap:hover .out-back {
	transform: translateZ(-200px) rotateY(180deg);
}

.wrap:hover .out-left {
	transform: translateX(-200px) rotateY(-90deg);
}

.wrap:hover .out-right {
	transform: translateX(200px) rotateY(90deg);
}

.wrap:hover .out-top {
	transform: translateY(-200px) rotateX(90deg);
}

.wrap:hover .out-bottom {
	transform: translateY(200px) rotateX(-90deg);
}

@keyframes rotate {
	0% {
		transform: rotateX(0deg) rotateY(0deg);
	}
	100% {
		transform: rotateX(360deg) rotateY(360deg);
	}
}